package com.ldwx.center.service;

import com.ldwx.center.dao.CompanyDao;
import com.ldwx.center.model.Company;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 公司模块service
 */
@Service
@Transactional
public class CompanyService {

    @Autowired
    private CompanyDao dao;

    public void add(Company company) {
        dao.save(company);
    }

    public void delete(String companyId) {
        dao.deleteById(companyId);
    }

    public void update(Company company) {
        dao.save(company);
    }

    public List<Company> findAll() {
        return dao.findAll();
    }

    public Company findById(String companyId) {
        return dao.findById(companyId).get();
    }
}
